package ca.ulaval.ift.gloo.SimSolution.model;

public class Arc {
	private int idArc;
	private float distance;
	
	//Les extremites de l'arc
	private Noeud ext1;
	private Noeud ext2;
	
	public Arc(int idArc, float distance, Noeud ext1, Noeud ext2) {
		if(ext1 != null && ext2 != null){
			this.idArc = idArc;
			this.distance = distance;
			this.ext1 = ext1;
			this.ext2 = ext2;
		}
		//else lever exception
		
	}
	
	public int getIdArc() {
		return idArc;
	}


	public float getDistance() {
		return distance;
	}


	public void setDistance(float distance) {
		this.distance = distance;
	}


	public Noeud getExt1() {
		return ext1;
	}


	public void setExt1(Noeud ext1) {
		this.ext1 = ext1;
	}


	public Noeud getExt2() {
		return ext2;
	}


	public void setExt2(Noeud ext2) {
		this.ext2 = ext2;
	}


	
	public Boolean isExtremite(Noeud n){
		return ext1.equals(n) || ext2.equals(n);
	}
	@Override
	public String toString() {
		return "Arc [idArc=" + idArc + ", distance=" + distance + ", ext1="
				+ ext1 + ", ext2=" + ext2 + "]";
	}


	@Override
	public boolean equals(Object obj) {
	    if (this == obj)
	        return true;
	    if (obj == null)
	        return false;
	    if (getClass() != obj.getClass())
	        return false;
	    final Arc other = (Arc) obj;
	    if (idArc != other.idArc)
	        return false;
	    return true;
	}
	
	
	
	
}
